﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Enyim.Caching;
using Enyim.Caching.Memcached;

namespace Janus.Cores.Cacheing
{
    public static class EnyimCachor //: MemcachedClient
    {
        public static readonly MemcachedClient mc = new MemcachedClient();

        public static bool Set(string key, object value)
        {
            return mc.Store(StoreMode.Set, key, value);
        }
        public static bool Store(StoreMode mode, string key, object value)
        {
            return mc.Store(mode, key, value);
        }
        public static bool Store(StoreMode mode, string key, object value, DateTime expiresAt)
        {
            return mc.Store(mode, key, value, expiresAt);
        }
        public static bool Store(StoreMode mode, string key, object value, TimeSpan validFor)
        {
            return mc.Store(mode, key, value, validFor);
        }
        public static bool TryGet(string key, out object value)
        {
            return mc.TryGet(key, out value);
        }
        public static bool TryGetWithCas(string key, out CasResult<object> value)
        {
            return mc.TryGetWithCas(key, out value);
        }

        public static T Get<T>(string key)
        {
            return mc.Get<T>(key);
        }
        public static object Get(string key)
        {
            return mc.Get(key);
        }
        public static bool Remove(string key)
        {
            return mc.Remove(key);
        }
    }
}
